<?php 


// 展示数据库列表
show databases;

// 创建数据库
create database school default character set utf8;

// 使用
use school;

// 删除数据库
drop database school;

// 创建表
create table stu(id zerofill int(10),sex enum('男','女','保密'),hobby set('看书','游戏','打架'));



create table stu (
	id int(6) AUTO_INCREMENT COMMENT '主键',
	name varchar(20) COMMENT '姓名',
	sex enum('男','女','保密') default '男' COMMENT '性别',
	qq int(10)  COMMENT 'qq',
	hobby set('看书','游戏','打架') COMMENT '爱好',
	phone varchar(11) COMMENT '手机',
	primary key id (id),
	unique qq (qq)
	) COMMENT '学生表';


CREATE TABLE `stu` (
  `id` int(6) unsigned NOT NULL AUTO_INCREMENT COMMENT '主建',
  `name` varchar(20) NOT NULL DEFAULT 'XX同学' COMMENT '姓名',
  `sex` enum('保密','女','男') NOT NULL DEFAULT '保密' COMMENT '性别',
  `hobby` set('打架','游戏','看书') NOT NULL DEFAULT '游戏,看书' COMMENT '爱好',
  `qq` int(10) unsigned DEFAULT NULL COMMENT 'qq',
  `phone` varchar(11) DEFAULT NULL COMMENT '手机',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into stu (name,sex,qq,phone,age) value('何子健','男','110112114','18925142345',20),('邓声明','男','110112114','18925142345',15),('黄镇江','男','110112114','18925142345',25),('郑晓晓','女','110112114','18925142345',30);


select * from stu;






create table stu (
	id int(10) AUTO_INCREMENT comment 'ID',
	name char(20) not null default 'XX同学' comment '姓名',
	phone varchar(11) not null default '13123123123' comment '电话',
	qq int(10) comment 'QQ',
	primary key (id),
	unique name_key (name)
	);


















 ?>